package com.njxxted.activiti.modules.process.extend.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.njxxted.activiti.modules.base.entity.BaseReqEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntityImpl;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;


/**
 * 描述：扩展流程实例历史表 Entity
 * <p>
 * 作者：HuTongFu
 * 邮箱：hu_tongfu@163.com
 * 时间：2019-08-12 16:58:12
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ExtendActHistoryEntity extends BaseReqEntity {

    private static final long serialVersionUID = 4156139510346923481L;
    //主键id
    private String id;
    //任务id
    private String taskId;
    //任务定义key
    private String taskDefKey;
    //任务名称
    private String taskName;
    //流程实例id
    private String processInstanceId;
    //流程定义key
    private String processDefKey;
    //业务id
    private String businessId;
    //操作类型
    private String operateType;
    //操作原因
    private String operateComment;

    //操作人
    private String operateUserId;
    //截止日期
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date deadline;
    //添加时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date addDate;

    public ExtendActHistoryEntity(HistoricTaskInstance hInstance) {
        HistoricTaskInstanceEntityImpl historicTaskInstanceEntity = (HistoricTaskInstanceEntityImpl) hInstance;
        this.taskId = historicTaskInstanceEntity.getId();
        this.taskName = historicTaskInstanceEntity.getName();
        this.processInstanceId = historicTaskInstanceEntity.getProcessInstanceId();
        this.taskDefKey = historicTaskInstanceEntity.getTaskDefinitionKey();
        this.deadline = historicTaskInstanceEntity.getDueDate();
    }

    public ExtendActHistoryEntity() {
    }

}
